package cn.campus.util;

import cn.campus.constant.article.PatternConstant;

import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.time.format.DateTimeFormatterBuilder;

/**
 * 日期工具类
 * Created by linyanbin on 2018/9/18.
 */
public class DateUtils {

    private DateUtils() {}

    /**
     * 根据日期格式获取当前日期字符串
     * @param pattern
     * @return Local Date String
     */
    public static String getcurrentDateString(String pattern) {
        LocalDate localDate = LocalDate.now();
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern(pattern);
        return localDate.format(formatter);
    }

}
